'''
数据类型的增删改查
冒泡排序
封装方法
'''


#################################一#################################

class Game:
    top_score = 0
    gamenum = 0

    def __init__(self, player_name):
        self.player_name = player_name
        Game.gamenum += 1

    @staticmethod
    def show_help():
        print("查看帮助信息：\n1、开始游戏\n2、查看历史最高分")

    @classmethod
    def show_top_score(cls):
        print(f"历史最高分：{cls.top_score}")

    def start_game(self):
        import random
        score = random.randint(0, 100)
        print(f"{self.player_name}的得分时:{score}")
        if score > Game.top_score:
            Game.top_score = score
        print(f"当前历史最高分：{Game.top_score}")


if __name__ == '__main__':
    Game.show_help()
    Game.show_top_score()
    player1 = Game("书豪")
    player1.start_game()
    player2 = Game("李四")
    player2.start_game()
    print(f"总共创建了{Game.gamenum}个游戏对象")


#################################二#################################
class Animal:
    def eat(self):
        print("吃肉")

    def drink(self):
        print("喝水")

    def sleep(self):
        print("睡觉")


class Dog(Animal):
    def bark(self):
        print("汪汪")


dog = Dog()
dog.eat()
dog.drink()
dog.sleep()
dog.sleep()

